package com.yunxi.service.localService.dealer.impl;

import com.github.pagehelper.PageInfo;
import com.yunxi.core.page.PageHelperPlus;
import com.yunxi.core.service.ServiceImplPlus;
import com.yunxi.dao.dealer.AreaManagerMapper;
import com.yunxi.dealer.pojo.AreaManagerVO;
import com.yunxi.model.dealer.AreaManager;
import com.yunxi.service.localService.dealer.AreaManagerService;
import com.yunxi.sys.pojo.StaffVO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 
 * @since 2019-07-23
 */
@Service
public class AreaManagerServiceImpl extends ServiceImplPlus<AreaManagerMapper, AreaManager> implements AreaManagerService {

   @Override
   public void delByUserCode(String userCode) {
      baseMapper.delByUserCode(userCode);
   }

   @Override
   public String getBigRegionCodeByCityManagerUserCode(String fellowId) {

     return baseMapper.getBigRegionCodeByCityManagerUserCode(fellowId);
   }

   @Override
   public PageInfo<AreaManagerVO> pageByUserCode(AreaManagerVO areaManagerVO, Integer pageNum, Integer pageSize) {
      PageHelperPlus.startPage(pageNum,pageSize);
      List<AreaManagerVO> list = baseMapper.pageByUserCode(areaManagerVO);
      PageInfo<AreaManagerVO> pageInfo = new PageInfo<AreaManagerVO>(list);
      return pageInfo;
   }

   @Override
   public List<AreaManagerVO> listByUserCode(AreaManagerVO areaManagerVO) {
      return  baseMapper.pageByUserCode(areaManagerVO);
   }

   @Override
   public List<String> getAreaManagerUserCodeByCityManagerUserCode(String fellowId) {
      return baseMapper.getAreaManagerUserCodeByCityManagerUserCode(fellowId);
   }

   @Override
   public PageInfo<AreaManagerVO> pageCityNotExisit(AreaManagerVO areaManagerVO, Integer pageNum, Integer pageSize) {
      PageHelperPlus.startPage(pageNum,pageSize);
      List<AreaManagerVO> list = baseMapper.pageCityNotExisit(areaManagerVO);
      for (AreaManagerVO vo : list) {
         vo.setAreaId(vo.getAreaCode());
      }
      PageInfo<AreaManagerVO> pageInfo = new PageInfo<AreaManagerVO>(list);
      return pageInfo;
   }
}
